package com.gh.cloud.user.fegin.fallback;

import com.gh.cloud.user.fegin.ProductFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author: guohao
 * @date: 2021-02-03 14:16
 **/
@Component
public class ProductFeignFallBackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new ProductFeign() {
            @Override
            public String getProductById(String id) {
                throwable.printStackTrace();
                return "this is fallback info..."+ throwable.getLocalizedMessage();
            }
        };
    }
}
